<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
		<head>
			<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
			<link rel="stylesheet" href="<c:url value="/resources/styles/springsource.css"/>" type="text/css"/>
			<title>Edit Account Details</title>
		</head>		
		<body>
		<div id="main_wrapper">
			<form:form commandName="account">
				<table>
					<tr>
						<td colspan="2">
							<h2>Edit Account Details</h2>
						</td>						
					</tr>
					<tr>
						<td>Customer Number:</td>
						<td><form:input path="contactNumber"/>
						    <br/>
						    <form:errors path="contactNumber"  cssClass="error" />
						</td>
					</tr>
 					<tr>
						<td>Customer Name:</td>
						<td><form:input path="name"/>
							<br/>
							<form:errors path="name" cssClass="error" />
						</td>
					</tr>
					<tr>
						<td>Credit Card Name:</td>
						<td><form:input path="creditCardNumber"/>
							<br/>
							<form:errors path="creditCardNumber" cssClass="error" />
						</td>
					</tr>
							
					<tr><td colspan="2"> 
						<table>
							<thead>								
								<tr>
									<td colspan="1">Beneficiaries:</td>
								</tr>
								<tr>
									<td>Name</td>
									<td>Allocation Percentage</td>
								</tr>
							</thead>
							<tbody>
								<c:forEach items="${account.beneficiaries}" var="beneficiary" varStatus="status">
									<tr>
										<td>
												<form:input path="beneficiaries[${status.index}].name" />
												<br/>
												<form:errors path="beneficiaries[${status.index}].name" cssClass="error"/>
										</td>
										<td>
												<form:input path="beneficiaries[${status.index}].allocationPercentage" />
												<br/>
												<form:errors path="beneficiaries[${status.index}].allocationPercentage" cssClass="error"/>
										</td>
									</tr>
								</c:forEach>
							</tbody> 
						</table>
					</td></tr>
					<tr>
						<td colspan="3">
						<input type="submit" name="_eventId_updateAccount" value="Update Account"/>	
						</td>
					</tr>
				</table>
			</form:form>
		</div>	
	</body>
</html>
